PROJECT(CONEX-App)

#find xerces package
FIND_PACKAGE(XERCESC REQUIRED)

#add the files to our groups and app
SOURCE_GROUP("app" ./app/*)
#seems to be a bug in cmake, can't put these in analysis\\standard folder :(
#upper detail

SET(CONEX-App_Files
    ./app/Application.cc
	./app/DbApp.cc
	./app/XmlApp.cc
	./app/CoApp.cc	
)

#find our headers
file(GLOB_RECURSE HEADERS ${CONEX-App_SOURCE_DIR}/*.h)


#create the libraries
INCLUDE_DIRECTORIES( ${CONEX_SOURCE_DIR}/src/app 
                     ${CONEX_SOURCE_DIR}/src/model
					 ${CONEX_SOURCE_DIR}/src/control
					 ${CONEX_SOURCE_DIR}/src/dal
					 ${CONEX_SOURCE_DIR}/src/util
					 ${CONEX_SOURCE_DIR}/src/ternary_tree)

add_executable(CONEX-App
	${CONEX-App_Files} 
	${HEADERS}
)

TARGET_LINK_LIBRARIES(CONEX-App 
                      optimized
                      CONEX-Model
					  CONEX-Control 
					  CONEX-Dal 
					  CONEX-Util 
					  ${XERCESC_LIBRARY})
					  
TARGET_LINK_LIBRARIES(CONEX-App 
                      debug
                      CONEX-Model
					  CONEX-Control 
					  CONEX-Dal 
					  CONEX-Util 
					  ${XERCESC_LIBRARY_DEBUG})

#set properties on the libraries
SET_TARGET_PROPERTIES(CONEX-App PROPERTIES
    VERSION ${CONEX_VERSION}
    SOVERSION ${CONEX_SOVERSION}
    COMPILE_DEFINITIONS_DEBUG _DEBUG
)

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
    if(DEFINED MINGW)
		SET(CMAKE_EXE_LINKER_FLAGS "-mwindows -fopenmp")
	else(DEFINED MINGW)
#	    SET_TARGET_PROPERTIES( CONEX-App PROPERTIES COMPILE_FLAGS "${CONEX_SOURCE_DIR}/src/dal/dal/db/otlv4.h" )
#        SET_TARGET_PROPERTIES( CONEX-App PROPERTIES LINK_FLAGS "odbc32.lib" )
		SET(CMAKE_CXX_FLAGS "/DGLUT_BUILDING_LIB /openmp")
		SET(CMAKE_EXE_LINKER_FLAGS "/subsystem:windows /entry:mainCRTStartup")
	endif(DEFINED MINGW)
else(CMAKE_SYSTEM_NAME MATCHES "Windows")
	SET(CMAKE_EXE_LINKER_FLAGS "-fopenmp")
endif(CMAKE_SYSTEM_NAME MATCHES "Windows")



